package cms.manage.template.value.impl;

import cms.bean.template.Forum;
import cms.bean.thirdParty.SupportLoginInterface;
import cms.manage.template.impl.SystemTemplateManage;
import cms.manage.template.value.TplValueStrategy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

import static cms.common.SystemConstant.DisplayType.DISPLAY_COLLECTION;

@Service("系统")
public class SystemStrategy implements TplValueStrategy {
    @Resource
    SystemTemplateManage systemTemplateManage;//系统部分 -- 模板方法实现
    @Override
    public Object doOperation(Forum forum, Map submitParameter, Map runtimeParameter) {
        if(forum.getForumChildType().equals("热门搜索词")){
            if(forum.getDisplayType().equals(DISPLAY_COLLECTION.getValue())){//集合
                List<String> value = systemTemplateManage.searchWordCollection(forum, submitParameter,runtimeParameter);
                return value;
            }
        }else if(forum.getForumChildType().equals("第三方登录")){
            if(forum.getDisplayType().equals(DISPLAY_COLLECTION.getValue())){//集合
                List<SupportLoginInterface> value = systemTemplateManage.thirdPartyLoginCollection(forum, submitParameter,runtimeParameter);
                return value;
            }
        }
        return null;
    }
}
